export const netCheckFn = async (name, fn) => {
  let netstate = window.localStorage.getItem('netstate');
  let res = {};
  if (netstate == 'online') {
    res = await fn();
    window.localStorage.setItem(name, JSON.stringify(res));
  } else {
    res = window.localStorage.getItem(name);
    if (res) {
      res = JSON.parse(res);
    } else {
      res = {};
    }
  }
  return res;
};
